from typing import Optional, Dict
from datetime import datetime
from pydantic import BaseModel, Field

class HistoryBase(BaseModel):
    """历史记录基础模型"""
    input_text: str = Field(..., description="输入文本")
    output_text: str = Field(..., description="输出文本")
    parameters: Optional[Dict] = Field(default={}, description="请求参数")

class HistoryCreate(HistoryBase):
    """创建历史记录模型"""
    pass

class HistoryUpdate(HistoryBase):
    """更新历史记录模型"""
    pass

class HistoryResponse(HistoryBase):
    """历史记录响应模型"""
    id: int
    type: str
    created_at: datetime

    class Config:
        from_attributes = True 